﻿using System;
using System.Text;
using System.Web.Security;
using System.Web.UI;

namespace EmptyWallGallery.FrontEnd.template
{
    public partial class Admin : MasterPage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            WriteAdminMenu(Roles.GetRolesForUser()[0]);
        }

        public void WriteAdminMenu(string currentRole)
        {
            var strOut = new StringBuilder();
            strOut.Append("");
            strOut.Append("<ul id=\"nav\">");
            strOut.Append("     <li class=\"first\"><a href=\"/inside/\" id=\"lnk_home\" class=\"selected\">Bảng điều khiển</a> </li>");
            if (currentRole == "Administrators")
            {
                strOut.Append("     <li><a href=\"/inside/Manage/\" id=\"lnk_manage\">Hệ thống</a>");
                strOut.Append("         <ul>");
                strOut.Append("             <li><a href=\"/inside/Manage/\">Quản lý thành viên</a></li>");
                strOut.Append("             <li><a href=\"/inside/Manage/Register.aspx\">Thêm mới thành viên</a></li>");
                strOut.Append("         </ul>");
                strOut.Append("     </li>");                
            }
            strOut.Append("     <li><a href=\"/inside/Editor/Articles/\" id=\"lnk_article\">Tin bài</a>");
            strOut.Append("         <ul>");
            strOut.Append("             <li><a href=\"/inside/Editor/Articles/\">Bài viết</a></li>");
            strOut.Append("             <li><a href=\"/inside/Editor/Articles/Create.aspx\">Thêm mới</a></li>");
            strOut.Append("         </ul>");
            strOut.Append("     </li>");
            //strOut.Append("     <li><a href=\"/inside/Editor/Video/\" id=\"lnk_video\">Video</a>");
            //strOut.Append("         <ul>");
            //strOut.Append("             <li><a href=\"/inside/Editor/Video/\">Quản lý</a></li>");
            //strOut.Append("             <li><a href=\"/inside/Editor/Video/Create.aspx\">Thêm mới</a></li>");
            //strOut.Append("         </ul>");
            //strOut.Append("     </li>");
            strOut.Append("     <li><a href=\"/inside/Editor/Gallery/Album.aspx\" id=\"lnk_gallery\">Quản lý tác phẩm</a>");
            strOut.Append("         <ul>");
            strOut.Append("             <li><a href=\"/inside/Editor/Gallery/Album.aspx\">Quản lý tác giả</a></li>");
            strOut.Append("             <li><a href=\"/inside/Editor/Gallery/Photo.aspx\">Quản lý tác phẩm</a></li>");
            strOut.Append("         </ul>");
            strOut.Append("     </li>");
            strOut.Append("</ul>");
            menu.InnerHtml = strOut.ToString();
        }
    }
}